package com.bank.api.model;

import java.io.Serializable;

public class Response implements Serializable {

    private boolean isSuccess;

    private Object data;


    private String message;

    public boolean isSuccess() {
        return isSuccess;
    }

    public Object getData() {
        return data;
    }

    public String getMessage() {
        return message;
    }

    private Response() {

    }

    public static Response wrapSuccess(Object result) {
        Response response = new Response();
        response.isSuccess = true;
        response.data = result;
        return response;
    }

    public static Response wrapSuccess() {
        Response response = new Response();
        response.isSuccess = true;
        response.data = null;
        return response;
    }

    public static Response wrapError(String msg) {
        Response response = new Response();
        response.isSuccess = false;
        response.data = null;
        response.message = msg;
        return response;
    }
}
